package com.jiahua.user.biz.model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the Invoice database table.
 * 
 */
@Entity
@NamedQuery(name="Invoice.findAll", query="SELECT i FROM Invoice i")
public class Invoice implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String invoiceID;

	private String createdDate;

	private String description;

	private int flag;

	private String invoiceNo;

	//bi-directional many-to-one association to Address
	@ManyToOne
	@JoinColumn(name="AddressID")
	private Address address;

	//bi-directional many-to-one association to InvoiceHistory
	@OneToMany(mappedBy="invoice")
	private List<InvoiceHistory> invoiceHistories;

	//bi-directional many-to-one association to Orders
	@OneToMany(mappedBy="invoice")
	private List<Orders> orders;

	//bi-directional many-to-one association to Shipping
	@OneToMany(mappedBy="invoice")
	private List<Shipping> shippings;

	public Invoice() {
	}

	public String getInvoiceID() {
		return this.invoiceID;
	}

	public void setInvoiceID(String invoiceID) {
		this.invoiceID = invoiceID;
	}

	public String getCreatedDate() {
		return this.createdDate;
	}

	public void setCreatedDate(String createdDate) {
		this.createdDate = createdDate;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getFlag() {
		return this.flag;
	}

	public void setFlag(int flag) {
		this.flag = flag;
	}

	public String getInvoiceNo() {
		return this.invoiceNo;
	}

	public void setInvoiceNo(String invoiceNo) {
		this.invoiceNo = invoiceNo;
	}

	public Address getAddress() {
		return this.address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	public List<InvoiceHistory> getInvoiceHistories() {
		return this.invoiceHistories;
	}

	public void setInvoiceHistories(List<InvoiceHistory> invoiceHistories) {
		this.invoiceHistories = invoiceHistories;
	}

	public InvoiceHistory addInvoiceHistory(InvoiceHistory invoiceHistory) {
		getInvoiceHistories().add(invoiceHistory);
		invoiceHistory.setInvoice(this);

		return invoiceHistory;
	}

	public InvoiceHistory removeInvoiceHistory(InvoiceHistory invoiceHistory) {
		getInvoiceHistories().remove(invoiceHistory);
		invoiceHistory.setInvoice(null);

		return invoiceHistory;
	}

	public List<Orders> getOrders() {
		return this.orders;
	}

	public void setOrders(List<Orders> orders) {
		this.orders = orders;
	}

	public Orders addOrder(Orders order) {
		getOrders().add(order);
		order.setInvoice(this);

		return order;
	}

	public Orders removeOrder(Orders order) {
		getOrders().remove(order);
		order.setInvoice(null);

		return order;
	}

	public List<Shipping> getShippings() {
		return this.shippings;
	}

	public void setShippings(List<Shipping> shippings) {
		this.shippings = shippings;
	}

	public Shipping addShipping(Shipping shipping) {
		getShippings().add(shipping);
		shipping.setInvoice(this);

		return shipping;
	}

	public Shipping removeShipping(Shipping shipping) {
		getShippings().remove(shipping);
		shipping.setInvoice(null);

		return shipping;
	}

}